package jee.boot.entity.log;

import jee.boot.common.basic.DataEntity;
import jee.boot.common.utils.JsonMapper;

/**
 * 日志对象
 */
public class LogEntity extends DataEntity<LogEntity> {
    //项目名称
    private String projectName;
    // 声明类型名,即代理
    private String serviceName;
    // 数据实体类型
    private String entityName;
    // 操作类型
    private String operator;
    // 访问地址
    private String remoteAddr;
    // 数据的主键
    private String entityId;
    // 数据
    private Object entity;
    // 检索条件,用空格隔开多个条件
    private String search;

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    public String getRemoteAddr() {
        return remoteAddr;
    }

    public void setRemoteAddr(String remoteAddr) {
        this.remoteAddr = remoteAddr;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getEntityId() {
        return entityId;
    }

    public void setEntityId(String entityId) {
        this.entityId = entityId;
    }

    public Object getEntity() {
        return entity;
    }

    public void setEntity(Object entity) {
        this.entity = entity;
    }

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    @Override
    public String toString() {
        StringBuilder sb=new StringBuilder();
        sb.append(" ").append(getProjectName());
        sb.append(" ").append(getRemoteAddr());
        sb.append(" ").append(getOperator());
        sb.append(" ").append(getServiceName());
        sb.append(" ").append(getEntityName());
        sb.append(" ").append(getEntityId());
        sb.append(" ").append(JsonMapper.toJsonString(getEntity()));
        return sb.toString();
    }
}
